/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entities;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author damfercer
 */
@Entity
@Table(name = "candidate_book_image", catalog = "facetoframe", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "CandidateBookImage.findAll", query = "SELECT c FROM CandidateBookImage c"),
    @NamedQuery(name = "CandidateBookImage.findByIdCandidateBookImage", query = "SELECT c FROM CandidateBookImage c WHERE c.idCandidateBookImage = :idCandidateBookImage"),
    @NamedQuery(name = "CandidateBookImage.findByImage", query = "SELECT c FROM CandidateBookImage c WHERE c.image = :image")})
public class CandidateBookImage implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ID_CANDIDATE_BOOK_IMAGE")
    private Integer idCandidateBookImage;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 128)
    @Column(name = "IMAGE")
    private String image;
    @JoinColumn(name = "CANDIDATE", referencedColumnName = "ID_CANDIDATE")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private Candidate candidate;

    public CandidateBookImage() {
    }

    public CandidateBookImage(Integer idCandidateBookImage) {
        this.idCandidateBookImage = idCandidateBookImage;
    }

    public CandidateBookImage(Integer idCandidateBookImage, String image) {
        this.idCandidateBookImage = idCandidateBookImage;
        this.image = image;
    }

    public Integer getIdCandidateBookImage() {
        return idCandidateBookImage;
    }

    public void setIdCandidateBookImage(Integer idCandidateBookImage) {
        this.idCandidateBookImage = idCandidateBookImage;
    }

    public String getImage() {
        return image;
    }

    public void setImage(String image) {
        this.image = image;
    }

    public Candidate getCandidate() {
        return candidate;
    }

    public void setCandidate(Candidate candidate) {
        this.candidate = candidate;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idCandidateBookImage != null ? idCandidateBookImage.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof CandidateBookImage)) {
            return false;
        }
        CandidateBookImage other = (CandidateBookImage) object;
        if ((this.idCandidateBookImage == null && other.idCandidateBookImage != null) || (this.idCandidateBookImage != null && !this.idCandidateBookImage.equals(other.idCandidateBookImage))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entities.CandidateBookImage[ idCandidateBookImage=" + idCandidateBookImage + " ]";
    }
    
}
